package com.zjl.workflow.listener;

import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import org.flowable.engine.delegate.event.FlowableProcessStartedEvent;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Auther: zhuangjl
 * @Date: 2021/11/26 12:17
 */
@Component
public class GlobalProcessStartedListener extends AbstractFlowableEngineEventListener {

    @Resource
    private RuntimeService runtimeService;

    @Override
    protected void processStarted(FlowableProcessStartedEvent event) {
        ExecutionEntityImpl entity = (ExecutionEntityImpl) event.getEntity();
        entity.setName("自定义执行器名称能否生效");
        entity.getParent().setName("自定义执行器名称");
    }
}
